package com.msh.feignService.fallback;

import com.msh.feignService.OrderService;
import com.msh.viewmodel.OrderViewModel;
import com.msh.viewmodel.Pager;
import com.msh.viewmodel.RequestPay;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.util.List;

/**
 * @author :zhangchuanfu
 * @Date :2023/1/14
 * @Time :18:41
 * @description :订单降级
 */
@Component
@Slf4j
public class OrderServiceFallbackFactory implements FallbackFactory<OrderService> {
    @Override
    public OrderService create(Throwable throwable) {
        log.info("订单服务调用失败",throwable);
        return new OrderService() {
            @Override
            public String requestPay(RequestPay requestPay) {
                return null;
            }

            @Override
            public Boolean cancel(String orderNo) {
                return null;
            }

            @Override
            public Pager<OrderViewModel> search(Integer pageIndex, Integer pageSize, String orderNo, String openId, LocalDate startDate, LocalDate endDate) {
                return null;
            }

            @Override
            public List<Long> getBusinessTop10Skus(Integer businessId) {
                return null;
            }
        };
    }
}
